﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace loc
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public int s = 86400;
        public int l = 7200;
        private void WebBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {

        }

        private void Button1_Click(object sender, EventArgs e)
        {
            if (button1.Text == "登录后点击")
            {
                timer1.Enabled = true;
                timer1.Interval = 1000;
                timer1.Start();
                login.Enabled = true;
                login.Interval = 1000;
                login.Start();
                //button1.Enabled = false;
                button1.Text = "停止";
                //Uri uri = new Uri("https://www.hostloc.com/");
                //login_web.Url = uri;
                Uri uri1 = new Uri("https://www.hostloc.com/?35101");
                Uri uri2 = new Uri("https://www.hostloc.com/?35102");
                Uri uri3 = new Uri("https://www.hostloc.com/?35103");
                Uri uri4 = new Uri("https://www.hostloc.com/?35104");
                Uri uri5 = new Uri("https://www.hostloc.com/?35105");
                Uri uri6 = new Uri("https://www.hostloc.com/?35106");
                Uri uri7 = new Uri("https://www.hostloc.com/?35107");
                Uri uri8 = new Uri("https://www.hostloc.com/?35108");
                Uri uri9 = new Uri("https://www.hostloc.com/?35109");
                Uri uri10 = new Uri("https://www.hostloc.com/?35110");
                Uri uri11 = new Uri("https://www.hostloc.com/?35111");
                Uri uri12 = new Uri("https://www.hostloc.com/?35112");
                Uri uri13 = new Uri("https://www.hostloc.com/?35113");
                Uri uri14 = new Uri("https://www.hostloc.com/?35114");
                Uri uri15 = new Uri("https://www.hostloc.com/?35115");
                Uri uri16 = new Uri("https://www.hostloc.com/?35116");
                Uri uri17 = new Uri("https://www.hostloc.com/?35117");
                Uri uri18 = new Uri("https://www.hostloc.com/?35118");
                Uri uri19 = new Uri("https://www.hostloc.com/?35119");
                Uri uri20 = new Uri("https://www.hostloc.com/?35120");
                web1.Url = uri1;
                web2.Url = uri2;
                web3.Url = uri3;
                web4.Url = uri4;
                web5.Url = uri5;
                web6.Url = uri6;
                web7.Url = uri7;
                web8.Url = uri8;
                web9.Url = uri9;
                web10.Url = uri10;
                web11.Url = uri11;
                web12.Url = uri12;
                web13.Url = uri13;
                web14.Url = uri14;
                web15.Url = uri15;
                web16.Url = uri16;
                web17.Url = uri17;
                web18.Url = uri18;
                web19.Url = uri19;
                web20.Url = uri20;
            }
            else if (button1.Text == "停止")
            {
                timer1.Stop();
                timer1.Enabled = false;
                login.Stop();
                login.Enabled = false;
                button1.Text = "登录后点击";
            }
            else {
                MessageBox.Show("发生未知错误，请等待修复bug后自动更新！");
            }
            
           
        }

        private void Timer1_Tick(object sender, EventArgs e)
        {
            if (s > 0) {
                s = s - 1;
            }
            else {
                //Uri uri = new Uri("https://www.hostloc.com/");
                //login_web.Url = uri;
                Uri uri1 = new Uri("https://www.hostloc.com/?35101");
                Uri uri2 = new Uri("https://www.hostloc.com/?35102");
                Uri uri3 = new Uri("https://www.hostloc.com/?35103");
                Uri uri4 = new Uri("https://www.hostloc.com/?35104");
                Uri uri5 = new Uri("https://www.hostloc.com/?35105");
                Uri uri6 = new Uri("https://www.hostloc.com/?35106");
                Uri uri7 = new Uri("https://www.hostloc.com/?35107");
                Uri uri8 = new Uri("https://www.hostloc.com/?35108");
                Uri uri9 = new Uri("https://www.hostloc.com/?35109");
                Uri uri10 = new Uri("https://www.hostloc.com/?35110");
                Uri uri11 = new Uri("https://www.hostloc.com/?35111");
                Uri uri12 = new Uri("https://www.hostloc.com/?35112");
                Uri uri13 = new Uri("https://www.hostloc.com/?35113");
                Uri uri14 = new Uri("https://www.hostloc.com/?35114");
                Uri uri15 = new Uri("https://www.hostloc.com/?35115");
                Uri uri16 = new Uri("https://www.hostloc.com/?35116");
                Uri uri17 = new Uri("https://www.hostloc.com/?35117");
                Uri uri18 = new Uri("https://www.hostloc.com/?35118");
                Uri uri19 = new Uri("https://www.hostloc.com/?35119");
                Uri uri20 = new Uri("https://www.hostloc.com/?35120");
                web1.Url = uri1;
                web2.Url = uri2;
                web3.Url = uri3;
                web4.Url = uri4;
                web5.Url = uri5;
                web6.Url = uri6;
                web7.Url = uri7;
                web8.Url = uri8;
                web9.Url = uri9;
                web10.Url = uri10;
                web11.Url = uri11;
                web12.Url = uri12;
                web13.Url = uri13;
                web14.Url = uri14;
                web15.Url = uri15;
                web16.Url = uri16;
                web17.Url = uri17;
                web18.Url = uri18;
                web19.Url = uri19;
                web20.Url = uri20;
                s = 86400;
            }
            label2.Text = s+ "秒后重新刷新其它页面";
            
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            MaximizeBox = false;
            Uri uri = new Uri("https://www.hostloc.com/");
            login_web.Url = uri;
        }

        private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Form form = new Thanks();
            form.Show();
        }

        private void Login_Tick(object sender, EventArgs e)
        {
            if (l > 0)
            {
                l = l - 1;
            }
            else
            {
                login_web.Refresh();
                l = 7200;
            }
            label1.Text = l + "秒后重新刷新登录页面";
        }

        private void LinkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Form form = new preview();
            form.Show();
        }
    }
}
